<form nz-form #dictionaryValueCreateOrEditForm="ngForm" (ngSubmit)="save()">
    <div class="modal-header">
        <div class="modal-title">
            <i nz-icon type="share-alt" class="mr-sm"></i>
            <span *ngIf="dictionaryValue.id">{{"Edit" | localize}}: {{dictionaryValue.name}}</span>
            <span *ngIf="!dictionaryValue.id&&!dictionaryValue.itemId">添加字典值</span>
            <span *ngIf="dictionaryValue.itemId&&dictionaryValue.itemName">{{'AddSubNodeForXParentNode' | localize:dictionaryValue.itemName}}</span>
        </div>
    </div>

    <fieldset>
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="4" nzFor="ValueName" nzRequired>
                值名称
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="20" nzHasFeedback>
                <input nz-input #valueName="ngModel" name="ValueName" [(ngModel)]="dictionaryValue.name"
                    placeholder="请输入值名称" required maxlength="128">
                <nz-form-explain *ngIf="valueName.dirty && valueName.errors">
                    <validation-messages [formCtrl]="valueName"></validation-messages>
                </nz-form-explain>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="4" nzFor="DValue" nzRequired>
                数据值
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="20" nzHasFeedback>
                <input nz-input #dValue="ngModel" name="DValue" [(ngModel)]="dictionaryValue.dValue"
                    placeholder="请输入数据值" required maxlength="128">
                <nz-form-explain *ngIf="dValue.dirty && dValue.errors">
                    <validation-messages [formCtrl]="dValue"></validation-messages>
                </nz-form-explain>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="4" nzFor="ValueSortCode" nzRequired>
                排序
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="20" nzHasFeedback>
                <input nz-input #valueSortCode="ngModel" name="ValueSortCode" [(ngModel)]="dictionaryValue.sortCode"
                    placeholder="请输入排序值" required maxlength="128">
                <nz-form-explain *ngIf="valueSortCode.dirty && valueSortCode.errors">
                    <validation-messages [formCtrl]="valueSortCode"></validation-messages>
                </nz-form-explain>
            </nz-form-control>
        </nz-form-item>
    </fieldset>

    <div class="modal-footer">
        <button nz-button [nzType]="'default'" type="button" (click)="close($event)" [disabled]="saving">
            {{"Cancel" | localize}}
        </button>
        <button nz-button [nzType]="'primary'" type="submit" [disabled]="!dictionaryValueCreateOrEditForm.form.valid || saving"
            [nzLoading]="saving">
            <i nz-icon type="save" *ngIf="!saving"></i> {{"Save" | localize}}
        </button>
    </div>

</form>
